Home

TEST




TEST

NAME
SYNOPSIS
DESCRIPTION
AUTHOR
COPYRIGHT
SEE ALSO

NAME

test − check file types and compare values

SYNOPSIS

test EXPRESSION
test

[ EXPRESSION ]
[
]
[
OPTION

DESCRIPTION

Exit with the status determined by EXPRESSION.

−−help

display this help and exit

−−version

output version information and exit

An omitted EXPRESSION defaults to false. Otherwise, EXPRESSION is true or false and sets exit status. It is one of:
( EXPRESSION )

EXPRESSION is true

! EXPRESSION

EXPRESSION is false

EXPRESSION1 −a EXPRESSION2

both EXPRESSION1 and EXPRESSION2 are true

EXPRESSION1 −o EXPRESSION2

either EXPRESSION1 or EXPRESSION2 is true

−n STRING

the length of STRING is nonzero

STRING

equivalent to −n STRING

−z STRING

the length of STRING is zero

STRING1 = STRING2

the strings are equal

STRING1 != STRING2

the strings are not equal

INTEGER1 −eq INTEGER2

INTEGER1 is equal to INTEGER2

INTEGER1 −ge INTEGER2

INTEGER1 is greater than or equal to INTEGER2

INTEGER1 −gt INTEGER2

INTEGER1 is greater than INTEGER2

INTEGER1 −le INTEGER2

INTEGER1 is less than or equal to INTEGER2

INTEGER1 −lt INTEGER2

INTEGER1 is less than INTEGER2

INTEGER1 −ne INTEGER2

INTEGER1 is not equal to INTEGER2

FILE1 −ef FILE2

FILE1 and FILE2 have the same device and inode numbers

FILE1 −nt FILE2

FILE1 is newer (modification date) than FILE2

FILE1 −ot FILE2

FILE1 is older than FILE2

−b FILE

FILE exists and is block special

−c FILE

FILE exists and is character special

−d FILE

FILE exists and is a directory

−e FILE

FILE exists

−f FILE

FILE exists and is a regular file

−g FILE

FILE exists and is set−group−ID

−G FILE

FILE exists and is owned by the effective group ID

−h FILE

FILE exists and is a symbolic link (same as −L)

−k FILE

FILE exists and has its sticky bit set

−L FILE

FILE exists and is a symbolic link (same as −h)

−O FILE

FILE exists and is owned by the effective user ID

−p FILE

FILE exists and is a named pipe

−r FILE

FILE exists and read permission is granted

−s FILE

FILE exists and has a size greater than zero

−S FILE

FILE exists and is a socket

−t FD

file descriptor FD is opened on a terminal

−u FILE

FILE exists and its set−user−ID bit is set

−w FILE

FILE exists and write permission is granted

−x FILE

FILE exists and execute (or search) permission is granted

Except for −h and −L, all FILE−related tests dereference symbolic links. Beware that parentheses need to be escaped (e.g., by backslashes) for shells. INTEGER may also be −l STRING, which evaluates to the length of STRING.

NOTE: [ honors the −−help and −−version options, but test does not. test treats each of those as it treats any other nonempty STRING.

NOTE: your shell may have its own version of test and/or [, which usually supersedes the version described here. Please refer to your shell’s documentation for details about the options it supports.

GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report [ translation bugs to <http://translationproject.org/team/>

AUTHOR

Written by Kevin Braunsdorf and Matthew Bradburn.

COPYRIGHT

Copyright © 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

SEE ALSO

The full documentation for test is maintained as a Texinfo manual. If the info and test programs are properly installed at your site, the command

info coreutils 'test invocation'

should give you access to the complete manual.


Open Source


Free Technology Academy - The FTA provides a virtual campus offering course modules on Free Software and Open Standards. Educational materials in the FTA are released under free licenses. FTA is constructed on a Free Software OS and utilizes Free Software and standards to deliver its services.

find - The find program searches for files that match the specified criteria and optionally executes some function on those files. Find can compare or identify files based on name, location, type, size, creation and many more attributes. find is a very useful and powerful command line utility.

College Prep - Get ready for college or earn college credit. EdX provides more than 40 High School and AP Exam Preparation Courses. Subjects range from mathematics to science, English and history. EdX courses help students succeed in High School and prepare for college. pre-calc calculus

Open Government - NASA, The White House and the Department of Defense are among government organizations with major open source deployments. Through the data.gov website which is part of the open government initiative, agencies deliver 180,000 data sets with open source access.

ConnectED and edX - President Obama announced on November 2014, that edX and ConnectED will partner to deliver teacher training and AP courses. ConnectED is the President's initiative to enhance K-12 through the delivery of broadband access and digital content.

Competitive Advantage - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies think about open source and how open source can give you the competitive advantage.

Open License - On October 29, 2015 the Department of Education announced a proposed regulation to require that all copyrightable intellectual property created with grant funds have an open license. Openly licensed materials can be modified and redistributed without violating copyright laws.

More Linux Commands


pamtohdiff (1)       - convert PAM image to horizontal difference image
This program is part of Netpbm(1) pamtohdiff takes a PAM (or PNM) image as input and produced a horizontal difference image version of it as output. A horizonta...

XpGetImageResolution (3x) - Gets the current image resolution for a print con...
XpGetImageResolution returns the current image resolution for the specified print context. A value of zero means the resolution automatically tracks the printer...

ls (1)               - list directory contents
ls.1 - List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified. Mandatory...

curl_global_init_mem (3) - Global libcurl initialisation with memory callbacks
This function works exactly as curl_global_init(3) with one addition: it allows the application to set callbacks to replace the otherwise used internal memory f...

XML::DOM::XMLDecl (3pm) - XML declaration in XML::DOM
XML::DOM::XMLDecl extends XML::DOM::Node, but is not part of the DOM Level 1 specification. It contains the XML declaration, e.g. &lt;?xml version=1.0 encoding=UTF...

gnutls_x509_crq_export (3) - API function
This function will export the certificate request to a PEM or DER encoded PKCS10 structure. If the buffer provided is not long enough to hold the output, then G...

auparse_next_record (3) - move record cursor
auparse_next_record will move the internal library cursors to point to the next record of the current event. You should not call this function from a feed inter...

SDL_MapRGBA (3)      - Map a RGBA color value to a pixel format
Maps the RGBA color value to the specified pixel format and returns the pixel value as a 32-bit int. If the format has a palette (8-bit) the index of the closes...

X11::Protocol::Ext::XFree86_Misc (3pm) - Perl module for the XFree86 Misc Extension
This module is used to access miscellaneous features of XFree86 servers SYMBOLIC CONSTANTS This extension adds the MouseTypes, KeyboardTypes and MouseFlags cons...

echo (1)             - display a line of text
Echo the STRING(s) to standard output. -n do not output the trailing newline -e enable interpretation of backslash escapes -E disable interpretation of backslas...

XDisplayName (3)     - default error handlers
Xlib generally calls the programs supplied error handler whenever an error is received. It is not called on BadName errors from OpenFont, LookupColor, or AllocN...

XShape (3)           - X nonrectangular shape functions
The X11 Nonrectangular Window Shape Extension adds nonrectangular windows to the X Window System. PREDEFINED VALUES Operations: ShapeSet ShapeUnion ShapeInterse...

XML::DOM::NodeList (3pm) - A node list as used by XML::DOM
The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. The item...

sane-rts8891 (5)     - SANE backend for rts8891 based scanners
The sane-rts8891 library implements a SANE (Scanner Access Now Easy) backend that provides access to scanners based on the rts8891 ASIC. The scanners that work...

flush (8)            - Postfix fast flush server
The flush(8) server maintains a record of deferred mail by destination. This information is used to improve the performance of the SMTP ETRN request, and of its...